// 导入http
import { http } from '@/utils/http'
import type { AddressParams, AddressItem } from '@/types/address'

// 获取地址API接口
export const setAddressAPI = (data : AddressParams) => {
  return http({
    url: '/member/address',
    method: 'POST',
    data
  })
}


// 获取收获地址列表API
export const getAddressListAPI = () => {
  return http<AddressItem[]>({
    url: '/member/address',
    method: 'GET'
  })
}

// 获取收获地址详情API
export const getAddressIdAPI = (id : string) => {
  return http<AddressItem>({
    url: `/member/address/${id}`,
    method: "GET"
  })
}


// 修改收获地址详情API
export const putAddressIdAPI = (id : string, data : AddressParams) => {
  return http({
    url: `/member/address/${id}`,
    method: "PUT",
    data
  })
}


// 删除地址详情API
export const delAddressIdAPI = (id : string) => {
  return http({
    url: `/member/address/${id}`,
    method: "DELETE"
  })
}
